{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
	{eq name="$id" value="0"}
	<h3 class="pb-3">新增</h3>
	{else/}
	<h3 class="pb-3">编辑</h3>
	{/eq}
	<table class="layui-table layui-table-form">
		<tr>
			<td class="layui-td-gray">供需内容<font>*</font></td>
			<td>
				<input style="height:100px" type="text" name="content" lay-verify="required" lay-reqText="请输入供需内容" placeholder="请输入供需内容" class="layui-input"
			  {notempty name="$note.content" }value="{$note.content}" {/notempty}>
			</td>
			
		</tr>
		
		<!-- <tr>
			<td class="layui-td-gray">排序</td>
			<td>
				<input type="text" name="sort" placeholder="请输入排序，数字" class="layui-input" {notempty
			  name="$note.sort" }value="{$note.sort}" {/notempty}>
			</td>
			
		</tr> -->
		<!-- <tr>
			<td class="layui-td-gray-2">
				<div class="layui-input-inline">上传图片</div>
				<div class="layui-input-inline">
					<button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button>
				</div>
			</td>
			<td colspan="5" style="line-height:inherit">
				<div class="layui-row" id="fileBox">
					<input type="hidden" data-type="file" name="file_ids" value="{$note.file_ids}">
					{notempty name="$note.file_ids"}
					{volist name="$note.fileArray" id="vo"}
					<div class="layui-col-md4" id="uploadImg{$vo.id}">{:file_card($vo)}</div>
					{/volist}
					{/notempty}
				</div>
			</td>
		</tr> -->
		<tr>
			<!-- <td class="layui-td-gray">展示期间<font>*</font></td>
			<td id="date">
				<div class="layui-input-inline">
					<input type="text" id="start_time" name="start_time" readonly lay-verify="required" lay-reqText="请选择公告展示开始时间" placeholder="请选择时间" class="layui-input" {notempty name="$note.start_time" }value="{$note.start_time | date='Y-m-d'}" {/notempty}>
				</div>
				-
				<div class="layui-input-inline">
					<input type="text" id="end_time" name="end_time" readonly lay-verify="required" lay-reqText="请选择公告展示结束时间" placeholder="请选择时间" class="layui-input" {notempty name="$note.end_time" }value="{$note.end_time | date='Y-m-d'}" {/notempty}>
				</div>
			</td> -->
			<td class="layui-td-gray">状态<font>*</font></td>
			<td>
				{if condition="$id eq 0"}
				<input type="radio" name="status" value="1" title="待处理">
				<input type="radio" name="status" value="2" title="通过审核" checked>
				<input type="radio" name="status" value="3" title="驳回">
				{else/}
				<input type="radio" name="status" value="1" title="待处理" {eq name="$note.status" value="1" }checked{/eq}>
				<input type="radio" name="status" value="2" title="通过审核" {eq name="$note.status" value="2" }checked{/eq}>
				<input type="radio" name="status" value="3" title="驳回" {eq name="$note.status" value="3" }checked{/eq}>
				{/if}
			</td>
		</tr> 
		<!-- <input type="hidden" name="status" value="1"> -->
		<!-- <tr>
			<td class="layui-td-gray">关联链接</td>
			<td>
				<input type="text" name="src" placeholder="请输入链接" class="layui-input" {notempty
			  name="$note.src" }value="{$note.src}" {/notempty}>
			</td>
			<td class="layui-td-gray">排序</td>
			<td>
				<input type="text" name="sort" placeholder="请输入排序，数字" class="layui-input" {notempty
			  name="$note.sort" }value="{$note.sort}" {/notempty}>
			</td>
		</tr> -->
		<!-- <tr>
			<td class="layui-td-gray" style="vertical-align:top;">问诊内容<font>*</font></td>
			<td colspan="3">
				<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" style="border:0;padding:0">{notempty name="$note.content" }{$note.content}{/notempty}</textarea>
			</td>
		</tr> -->
	</table>

	<div class="py-3">
		<input type="hidden" name="id" value="{$id}" />
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool','oaTool','tinymce'];
	function gouguInit() {
		var form = layui.form,tool=layui.tool,laydate = layui.laydate,oaTool=layui.oaTool;;
		//日期范围
		oaTool.addFile();
		laydate.render({
			elem: '#date',
			range: ['#start_time', '#end_time'],
			rangeLinked:true
		});

		//编辑器初始化
		var editor = layui.tinymce;
		var edit = editor.render({
			selector: "#container",
			images_upload_url: '/api/index/upload/sourse/tinymce',//图片上传接口
			height: 500
		});
		
		//监听提交
		form.on('submit(webform)', function (data) {
			/*data.field.content = tinyMCE.editors['container'].getContent();
			if (data.field.content == '') {
				layer.msg('请先完善公告内容');
				return false;
			}*/
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					tool.sideClose(1000);
				}
			}
			tool.post("/note/index/interaction_edit", data.field, callback);
			return false;
		});
}
</script>
{/block}
<!-- /脚本 -->